package com.cedric.yixianpai.game.cards.Sects.swordCards.e_HuaShen;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class WanFaGuiLingJian extends SwordCard {
    private final int m;
    /**
     * title:万法归灵剑
     * effect:5攻 耗尽灵气，每耗1点多5/6/7攻
     */
    public WanFaGuiLingJian(@Value("1") int lvl) {
        super("万法归灵剑");
        this.setLevel(lvl);
        this.setPeriod(Period.HUASHEN);
        this.setDescription("5攻 耗尽灵气，每耗1点多5/6/7攻");

        this.setDamage(5);
        if (1 == lvl) {
            m =5;
        } else if (2 == lvl) {
            m =5;
        } else if (3 == lvl) {
            m =5;
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        int atk=this.getDamage()+Sta1.getPlayerBuff().getSpiritualEnergy()*this.m;
        Sta1.attack(Sta2,atk);
        Sta1.getPlayerBuff().clearSwordIntent();
        Sta1.getPlayerBuff().clearSpiritualEnergy();
        return true;
    }
}
